* Footnote 23

* Dollar manufacturing wages relative to import prices
use "temp/EIA_clean.dta", clear
bys year: egen totaldomsales = total(salesdom)
gen salesdomUSD = totaldomsales / er
bys year: egen wage_avg = mean(wages) if salestot!=0 // average cross sectional wage, exclude firms with zero sales
gen wage_usd = wage_avg / er

preserve
collapse (mean) wage_usd, by(year)
sort year
merge 1:1 year using "input/UVI_MEX.dta"
drop _merge
drop if year==1993
gen temp1 = 0
replace temp1 = 1 if year==1994
foreach x of var wage_usd {
gen `x'_trade = `x' / (UVIM)
gen `x'_temp = `x'_trade * temp1
egen `x'_trade94 = total(`x'_temp)
gen `x'_growth = (`x'_trade/`x'_trade94-1)*100
}
drop if year==1994
drop if year>=2000
egen wage_growth_avg = mean(wage_usd_growth)
keep if year==1995
drop year
label var wage_growth_avg "Dollar wages relative to import prices"
export excel wage_growth_avg using "../../Output/Footnote23_Mex", first(varl) sh("Wage") replace
restore

* Dollar domestic sales
preserve
collapse salesdomUSD, by(year)
keep if year>=1994 & year<=1999
gen temp1 = 0
replace temp1 = 1 if year==1994	
foreach x of var salesdomUSD{
gen `x'temp = `x' * temp1
egen `x'94 = total(`x'temp)
gen `x'_growth = (`x'/`x'94-1)*100
drop `x'temp
}	
drop if year==1994
collapse salesdomUSD_growth
label var salesdomUSD_growth "Dollar domestic sales"
export excel salesdomUSD_growth using "../../Output/Footnote23_Mex", first(varl) sh("DomSales")
restore
